package nl.jworks.epuborganizer.server;

import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import nl.jworks.epuborganizer.client.GreetingService;
import nl.jworks.epuborganizer.service.SpringGreetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
// TODO: Remove this annotation once this https://github.com/gwt-maven-plugin/gwt-maven-plugin/pull/26 has been patched
@RemoteServiceRelativePath("greet")
public class GreetingServiceImpl extends AutoinjectingRemoteServiceServlet implements GreetingService {

    private SpringGreetingService greetingServiceSpring;

    public String greetServer(String name) {
        return greetingServiceSpring.sayHello(name);
    }

    @Autowired
    @Required
    public void setGreetingService(SpringGreetingService greetingService) {
        this.greetingServiceSpring = greetingService;
    }

}
